package day7;

import java.util.Arrays;

/**
 * @author oldliu
 * @since 1.0
 */
public class FordBall {
    public static void main(String[] args) {
        int[] balls = new int[6];
        for (int i = 0; i < balls.length; ) {
            int t = (int) (Math.random() * 33) + 1;
            //当前值i和0到i-1位置上的数不重复。。。
            boolean chongfu = false;
            for (int j = 0; j < i; j++) {
                if (balls[j] == t) {
                    chongfu = true;
                    break;
                }
            }
            if (chongfu == false) {
                balls[i]=t;
                i++;
            }
        }
        System.out.println(Arrays.toString(balls));
        Arrays.sort(balls);
        balls=Arrays.copyOf(balls,7);
        balls[balls.length-1]= (int) (Math.random()*16+1);
        System.out.println(Arrays.toString(balls));
    }
}
